package maxSum;

public class mainTest {
	
	
	public int Findmax(int[] sum) {
		int result1=sum[0];
		int result2;
		for(int item:sum) {
			if(item>result1)
				result1 = item;
		}
		if(sum[0]!=result1) result2=sum[0];
		else result2=sum[1];
		for(int item:sum) {
			if(item>result2 && item!=result1) {
				result2=item;
			}
		}
		
		return result1+result2;
	}
	
	public static void main(String[] args) {
		int[] sum = {1,-2,3,5,-1};
		mainTest test = new mainTest();
		System.out.println(test.Findmax(sum));
	}
	
}
